package com.wlp.pengpicturebackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wlp.pengpicturebackend.model.dto.user.UserQueryRequest;
import com.wlp.pengpicturebackend.model.dto.user.UserRegisterRequest;
import com.wlp.pengpicturebackend.model.entity.User;
import com.wlp.pengpicturebackend.model.vo.LoginUserVO;
import com.wlp.pengpicturebackend.model.vo.UserVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

public interface UserService extends IService<User> {
    /**
     * 用户注册
     * @param dto:
     * @Author: wlp
     * @Date: 2025/1/3 9:56
     * @return: long
     **/
    long userRegister(UserRegisterRequest dto);

    /**
     * 用户登录
     *
     * @param userAccount  用户账户
     * @param userPassword 用户密码
     * @param request
     * @return 脱敏后的用户信息
     */
    LoginUserVO userLogin(String userAccount, String userPassword, HttpServletRequest request);


    /**
     * 获取加密后的密码
     * @Author: wlp
     * @Date: 2025/1/3 10:07
     * @param userPassword:
     * @return: java.lang.String
     **/
    String getEncryptPassword(String userPassword);

    /**
     * 获取当前的用户信息
     * @Author: wlp
     * @Date: 2025/1/3 16:36
     * @param request:
     * @return: com.wlp.pengpicturebackend.model.entity.User
     **/
    User getLoginUser(HttpServletRequest request);

    /**
     * 获得脱敏后的的的登录用户信息
     * @Author: wlp
     * @Date: 2025/1/3 11:29
     * @param user:
     * @return: com.wlp.pengpicturebackend.model.vo.LoginUserVO
     **/
    LoginUserVO getLoginUserVO(User user);

    /**
     * 获得脱敏后的用户信息
     * @Author: wlp
     * @Date: 2025/1/6 9:29
     * @param user:
     * @return: com.wlp.pengpicturebackend.model.vo.LoginUserVO
     **/
    UserVO getUserVO(User user);

    /**
     * 获得脱敏后的用户列表
     * @Author: wlp
     * @Date: 2025/1/6 9:30
     * @param userList:
     * @return: java.util.List<com.wlp.pengpicturebackend.model.vo.UserVO>
     **/
    List<UserVO> getUserVOList(List<User> userList);

    /**
     * 用户注销
     * @Author: wlp
     * @Date: 2025/1/3 16:45
     * @param request:
     * @return: com.wlp.pengpicturebackend.model.entity.User
     **/
    boolean getLogout(HttpServletRequest request);

    /**
     * 获取查询条件
     * @Author: wlp
     * @Date: 2025/1/6 9:37
     * @param userQueryRequest:
     * @return: com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
     **/
    QueryWrapper<User> getQueryWrapper(UserQueryRequest userQueryRequest);


    /**
     * 是否为管理员
     * @Author: wlp
     * @param user
     * @return
     */
    boolean isAdmin(User user);


}
